<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>9.定位叠加很重要</title>
  <style>
    * {
      padding: 0;
      margin: 0;
    }

    body {
      padding: 30px;
    }

    ul {
      list-style: none;
    }

    ul li {
      width: 300px;
      height: 300px;
      border: solid 8px blueviolet;
      position: relative;
      cursor: pointer;
    }

    ul li img {
      width: 100%;
      position: absolute;
      z-index: 2;

    }

    ul li>span {
      position: absolute;
      width: 30px;
      height: 30px;
      background: blueviolet;
      border-radius: 50%;
      text-align: center;
      font-size: 14px;
      color: white;
      line-height: 2em;
      left: 10px;
      top: 10px;
      box-shadow: 0 0 10px #333;
      z-index: 3;
    }

    div {
      width: 100%;
      height: 100%;
      background: #333;
      position: relative;
      z-index: 1;
    }

    div h2 {
      text-align: center;
      line-height: 10em;
      color: white;
    }

    ul li:hover img {
      z-index: -2;
    }
  </style>
</head>

<body>
  <ul>
    <li>

      <span>热</span>
      <img
        src="https://thirdwx.qlogo.cn/mmopen/vi_32/6vSia5Z55Da4cpRvjw3yDB7DicRobfD9ZzTqUWEI7F1sKqic8r7nWdtsXUcmt79Cia3zYYuhmn2najKnV9A4dic3IFw/132"
        alt="">
      <div>
        <h2>定位操作布局</h2>
      </div>
    </li>
  </ul>
</body>

</html>